<?php
class MY_Controller extends Controller{

	function MY_Controller(){
		parent::Controller();
		$this->load->library('zacl');
		$this->load->library('session');
		$this->load->library('simplelogin');
		$this->load->model('user_model');
		$resource = $this->router->class.'_'.$this->router->method;
		//echo $resource;
		$on = false;
		if($this->user_model->check_login()){
			$on = true;
			$user = $this->session->userdata('user');
			$role = $user['role'];
			if(!$this->zacl->check_acl($resource,$role)){
				$on = false;
			}
		}
		
		
		if($on==false){
			redirect('/cp_admin/login');
		}
	}
}